home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2005 October
/
PCWOCT05.iso
/
Software
/
FromTheMag
/
Syn Text Editor 2.1.0.46
/
synsetup-2.1.0.46.exe
/
{app}
/
contributed
/
blitzbasic
/
codefinder.vbs
< prev
next >
Wrap
Text File
|
2004-02-29
|
3KB
|
161 lines
' Blitz Basic CodeFinder by Peter Sheutz
' For Syn Edit (made in/for version 2.0.0.23)
' Public Domain 2002-09-07
'
' USAGE: View -> Options - > Makro -> Add (select Codefinder.Vbs)
' "Check Create ToolBar Buttons For:"
'
' Right Click the toolbar Select "Customize"
' In the Keyboard Tab Select -> Category - > Codefinder
' Assign a key (I use F2)
'
' With a .bb File loaded, press the hot key.
' Single clicking will Select the Function/Type/Label
' Single clicking will Select the Function/Type/Label And close dialog.
'
' Save this file as Codefinder.Vbs
Option Explicit
const mrOK = 1
Dim codeList
Dim btnOK, btnFunctions, btnTypes, btnLabels
Dim linesIndex()
Dim form
Sub ListClick(Sender)
Dim sel
sel = Sender.Items(Sender.ItemIndex)
ActiveDocument.HighlightLine linesIndex(Sender.ItemIndex), 1, 0
End Sub
Sub ListDblClick(Sender)
Dim sel
sel = Sender.Items(Sender.ItemIndex)
ActiveDocument.HighlightLine linesIndex(Sender.ItemIndex), 1, 0
btnOK.Click
End Sub
Sub ListLines(ls)
Dim i, l, p
Dim funcstr
Dim count
ReDim linesIndex(2000)
While codeList.Items.count > 0
codeList.Items.Delete (0)
Wend
With codeList
.Parent = form
.Left = 2
.Top = 2 + 20
.Width = .Parent.Width - 10
.Height = .Parent.Height - 44
.OnClick = "ListClick"
.OnDblClick = "ListDblClick"
End With
Set l = ActiveDocument.Lines
For i = 0 To l.count - 1
If Trim(UCase(Left(l(i), Len(ls)))) = ls Then
p = InStr(UCase(l(i)), ls)
If ls <> "." Then p = InStr(p + 1, l(i), " ")
If p Then
funcstr = Right(l(i), Len(l(i)) - p)
codeList.Items.Add funcstr
If i < 2000 Then linesIndex(count) = i + 1
count = count + 1
End If
End If
Next
ReDim Preserve linesIndex(count)
End Sub
Sub EditChange(Sender)
If Sender.Caption = "Functions" Then ListLines "FUNCTION"
If Sender.Caption = "Types" Then ListLines "TYPE"
If Sender.Caption = "Labels" Then ListLines "."
End Sub
Sub Main(dummy)
If Documents.count = 0 Then
MsgBox "No Document open.", vbCritical
Exit Sub
End If
form = Create("TForm", Self)
With form
.Caption = "Blitz Code Finder"
.Position = "poOwnerFormCenter"
.BorderStyle = "bsDialog"
.Width = 380
.Height = 400
End With
btnFunctions = Create("TButton", form)
With btnFunctions
.Parent = form
.Top = 2
.Caption = "Functions"
.Left = 2
.Height = 20
.Width = 70
.OnClick = "EditChange"
End With
btnTypes = Create("TButton", form)
With btnTypes
.Parent = form
.Top = 2
.Caption = "Types"
.Left = 2 + 74
.Height = 20
.Width = 70
.OnClick = "EditChange"
End With
btnLabels = Create("TButton", form)
With btnLabels
.Parent = form
.Top = 2
.Caption = "Labels"
.Left = 2 + 74 + 74
.Height = 20
.Width = 70
.OnClick = "EditChange"
End With
btnOK = Create("TButton", form)
With btnOK
.Parent = form
.Top = 65
.Caption = "OK"
.Left = 46
.Default = True
.ModalResult = mrOK
End With
codeList = Create("TListBox", form)
codeList.Parent = form
ListLines "FUNCTION"
form.ShowModal
form.Free
End Sub